Skip to content

Conversation

@ldorau
Copy link
Contributor

@ldorau ldorau commented Oct 23, 2024

Description

Use std::vector<char> instead of std::unique_ptr<char[]>
because we do not need to use memset(0) in this case.

Checklist

  • Code compiles without errors locally
  • All tests pass locally
  • CI workflows execute properly

@ldorau ldorau marked this pull request as ready for review October 23, 2024 11:10
@ldorau ldorau requested a review from a team as a code owner October 23, 2024 11:10
@ldorau ldorau force-pushed the Use_std_vector_char_instead_of_std_unique_ptr_char branch from 0aaee44 to 3db24c4 Compare October 23, 2024 11:25
@ldorau
Copy link
Contributor Author

ldorau commented Oct 23, 2024

Rebased

void *buf = buffer.get();
// preallocate some memory and initialize the vector with zeros
std::vector<char> buffer(init_buffer_size, 0);
void *buf = buffer.data();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume implicit cast by Coverity due to type conversion:
data() returns value_type*, in this case char*
https://cplusplus.com/reference/vector/vector/data/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KFilipek Done

Use std::vector<char> instead of std::unique_ptr<char[]>
because we do not need to use memset(0) in this case.

Signed-off-by: Lukasz Dorau <[email protected]>
@ldorau ldorau force-pushed the Use_std_vector_char_instead_of_std_unique_ptr_char branch from 3db24c4 to a4080b4 Compare October 23, 2024 12:00
@ldorau ldorau requested a review from KFilipek October 23, 2024 12:00
Copy link
Contributor

@KFilipek KFilipek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@KFilipek KFilipek merged commit 1b3d694 into oneapi-src:main Oct 23, 2024
75 checks passed
@ldorau ldorau deleted the Use_std_vector_char_instead_of_std_unique_ptr_char branch October 23, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants